﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using FasterWPF;
using System.Windows.Media;
using System.Windows;

namespace FasterWPFDemo
{
    public class UserControlRegion: Border
    {
        public UserControlRegion(Brush backgroundColor)
        {
            this.Initialize(ContainerType.DockPanel);
            this.SetCompositeDockPanelLastChildFill(true);

            if (backgroundColor != null)
            {
                BorderExt.ChangeBackgroundColor(this, backgroundColor);
            }

            this.MinHeight = 50D;
            this.MinWidth = 50D;
        }

        public string AddUserControl( UserControl euc )
        {
            string key = Guid.NewGuid().ToString();
            this.BeginComposite<Border>(key).AddExisting<UserControl, Border>(0, 0, euc).EndComposite<Border, BorderArgs>(null);
            return key;
        }

        public string AddUserControl(UserControl euc, string key)
        {
            this.BeginComposite<Border>(key).AddExisting<UserControl, Border>(0, 0, euc).EndComposite<Border, BorderArgs>(null);
            return key;
        }
    }
}
